package net.sky.oa.model;

import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Type;

/**
 * 回帖表
 * REPLIES. @author ...
 */
@Entity
@Table(name = "REPLIES")//日志评论表
public class ReplyPost implements java.io.Serializable {

	private static final long serialVersionUID = 5673991033245515351L;
	
	// Fields

	protected Long id;
	private String content; //回帖内容
	private Date createtime;//回帖时间
	private Integer status;  //状态
	private SendPost sendpost; //引用帖子
	private SysEmployee user; //回帖人
	private String dept;//回帖部门

	// Constructors

	/** default constructor */
	public ReplyPost() {
	}
	
	@Id
    @Column(name = "ID", unique = true, nullable = false)
	@SequenceGenerator(name="SQ_REPLIES_ID",sequenceName="SQ_REPLIES_ID",allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="SQ_REPLIES_ID")
	public Long getId() {
        return id;
    }

    public void setId(Long id){
    	this.id = id;
    }

	/** minimal constructor */
	public ReplyPost(Long id) {
		this.id = id;
	}
	
	@Lob
    @Basic(fetch = FetchType.EAGER)
    @Column(name = "CONTENT", columnDefinition = "CLOB", nullable = true)
    @Type(type ="org.springframework.orm.hibernate3.support.ClobStringType")
	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "CREATETIME")
	public Date getCreatetime() {
		return this.createtime;
	}

	public void setCreatetime(Date createtime) {
		this.createtime = createtime;
	}

	@Column(name = "STATUS", precision = 2, scale = 0)
	public Integer getStatus() {
		return this.status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "SENDPOST_ID")
	public SendPost getSendpost() {
		return sendpost;
	}

	public void setSendpost(SendPost sendpost) {
		this.sendpost = sendpost;
	}
    
	@Column(name = "DEPT", length = 100)
	public String getDept() {
		return dept;
	}

	public void setDept(String dept) {
		this.dept = dept;
	}

	public static long getSerialVersionUID() {
		return serialVersionUID;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "USER_ID")
	public SysEmployee getUser() {
		return this.user;
	}

	public void setUser(SysEmployee user) {
		this.user = user;
	}

}